<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../lib/vue.js"></script>
</head>
<body>
    <div id="box">
        <aaa></aaa>
    </div>

<script>
    var Aaa = Vue.extend({
        template: '<h3 @click="change">{{msg}}</h3>',

        //注意data必须是个函数.返回的是个对象
        data: function(){
            return {
                msg: "我是标题啊"
            }
        },
        methods: {
            change: function () {
                this.msg = 'changed'
            }
        }
    })

    //这里全局定义
    Vue.component('aaa',Aaa);

    var vm = new Vue({
        el: '#box'
    })
</script>
</body>
</html>